<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
	<!doctype html>
<html>
<head>
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no" />
<meta charset="UTF-8">
<title>消息测试</title>

<link rel="stylesheet" href="/css/vendor/common.css" type="text/css">
<link href="/css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="/css/vendor/add-drone.less" rel="stylesheet/less"
	type="text/css">
<script src="/js/less.min.js"></script>
<style>
button {
	margin-left: 20px;
}
</style>
</head>

<body>

	<main>
	<form>
		<div class="title-bar">
			<label class="server-id">用户</label>
		</div>

		<div id="info-wrap">
			<table>
				<tr>
					<th>用户:</th>
					<td>
					<select name="user">
						{% for user in userList %}
							<option value="{{ user['id'] }}">{{ user['nickname'] }}</option>
						{% endfor %}	
					</select></td>
				</tr>
				<!-- <tr>
					<th>类型:</th>
					<td><select name="message_type">
							<option value="web_warranty">质保到期</option>
							<option value="web_insurance">保险到期</option>
							<option value="web_maintain">保养提醒</option>
							<option value="web_message">自定义消息</option>
					</select></td>
				</tr> -->
				<tr>
					<th>消息:</th>
					<td><input type="text" value="" name="message" /></td>
				</tr>

			</table>

		</div>
		<p id="save-btn" class="button" onclick="sendMessage()">添加</p>
	</form>
	</main>

<script src="/js/jquery-3.2.1.min.js"></script>
<script src="/js/bootstrap.min.js"></script>
<script src="/js/vendor/common.js"></script>
</body>

<script>
	function sendMessage() {
		$.post("/notification/sendMessage", $("form").serialize(), function(result) {
			var str = JSON.stringify(result);
			alert(str);
		});
	}
</script>
</html>